# ~/.bashrc

HISTSIZE=-1
HISTFILESIZE=-1
HISTCONTROL=ignorespace:ignoredups

# If not running interactively, don't do anything
[[ $- != *i* ]] && return

bind 'set match-hidden-files off'

alias ls='ls --color=auto'
#PS1='[\u@\h \W]\$ '
export PS1="\[\e[1;33m\]\A\[\e[m\] \[\e[1;35m\]\u\[\e[m\]\[\e[1;36m\]@\[\e[m\]\[\e[1;35m\]\h\[\e[m\] \[\e[1;36m\]\w\[\e[m\] "
source ${HOME}/.aliases

_get_WP() {
    local wpcount=$(($(ls ~/.config/walls/ | wc -l)))
    local rand=$((RANDOM))
    local wall=~/.config/walls/wall$(((($rand % $wpcount + $wpcount) % $wpcount) + 1)).png
    echo $wall
}

reroll() {
    feh --bg-fill --randomize $($HOME/.config/walls/random-theme)
}

function stream() {
    mpv --ytdl-format=bestaudio ytdl://ytsearch:"$*"
}

function calc() {
    echo ""$*"" | bc -l
}

function calc() {
    echo "$*" | bc -l
}

transfer() {
    for i in "$@"; do
        finalResult="$(curl -sS -T $i https://transfer.sh/)"
        printf "$finalResult" | xclip -sel clip
        echo "uploaded!" "${finalResult}"
    done
}

shootscreentowebs() {
    scrot 'screenshot.jpg' -e 'mv $f /tmp/screenshot.jpg'
    transfer /tmp/screenshot.jpg
}

recency_find() {
    find . -maxdepth 2 -printf "%T@ %Tc %p\n" | sort -n
}

u() {
    DOC=
    [ ! -z $2 ] && DOC=doc/
    TARGET="${HOME}/uni/${DOC}$(ls ${HOME}/uni/${DOC} | agrep $1 | head -n 1)"
    cd "${TARGET}"
}

udoc() {
    u $1 doc
}

merge_pdfs() {
    gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=$@
}

source ${HOME}/.profile

export QSYS_ROOTDIR="/media/programs/quartus/quartus/sopc_builder/bin"
